import request from '@/utils/request'

export default {
  getAlarmList(searchModel) {
    return request({
      url: '/alarm/list',
      method: 'get',
      params: {
        alarmEquipment: searchModel.alarmEquipment,
        pageNo: searchModel.pageNo,
        pageSize: searchModel.pageSize
      }
    })
  },
  addAlarm(alarm) {
    return request({
      url: '/alarm/add',
      method: 'post',
      data: alarm
    })
  },
  saveAlarm(alarm) {
    if (alarm.id == null || alarm.id === undefined) {
      return this.addAlarm(alarm)
    }
    return this.updateAlarm(alarm)
  },
  updateAlarm(alarm) {
    return request({
      url: '/alarm/update',
      method: 'put',
      data: alarm
    })
  },
  getAlarmById(id) {
    return request({
      // url: '/alarm/' + id,
      url: `/alarm/${id}`,
      method: 'get'
    })
  },
  deleteAlarmById(id) {
    return request({
      url: `/alarm/delete/${id}`,
      method: 'delete'
    })
  },
  getAllAlarmList() {
    return request({
      url: '/alarm/all',
      method: 'get'
    })
  },
}
